type TOption = {
  name: string;
  value: string | number | boolean;
  [key: string]: any;
};

export default (options: TOption[]) => {
  const map = new Map();

  const get = (id): TOption | undefined => map.get(id);

  options.forEach((item) => {
    map.set(item.value, item);
  });

  return { get };
};
